package org.yx.service.smfr.view_work_order_need_input_material;

import com.xiaoleilu.hutool.util.StrUtil;
import org.dbist.dml.Query;
import org.yx.models.SbasMatDef;
import org.yx.utils.BaseService;

/**
 * 查询工单需要投料清单
 *
 * @author zxw
 * @since 2023/03/22
 **/
public class SmfrViewWorkOrderNeedInputMaterialService extends BaseService {
    public SmfrViewWorkOrderNeedInputMaterialOut viewWorkOrderNeedInputMaterial(SmfrViewWorkOrderNeedInputMaterialIn in) throws Exception {
        SmfrViewWorkOrderNeedInputMaterialOut out = new SmfrViewWorkOrderNeedInputMaterialOut();
        if (StrUtil.isBlank(in.getMo())) {
            return out;
        }

        Query query = new Query();
        query.addFilter("orgCode", in.getUserOrgCode());
        query.addFilter("mo", in.getMo());
        query.addFilter("matCode",in.getMatCode());
        query.addFilter("matVer",in.getMatVer());
        out.setMatList(selectListBySqlPath("select_work_order_bom", query, SbasMatDef.class));

        return out;
    }
}